<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      .header {
        width: 100%;
        height: 60px;
        background-color: lightblue;
        display: flex;
        justify-content: center;
      }

      ul {
        height: 60px;
        line-height: 60px;
        display: flex;
      }

      li {
        list-style: none;
        margin: 0 30px;
      }

      .wrap {
        width: 1000px;
        margin: 0 auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
      }

      .item {
        width: 220px;
        height: 200px;
        background-color: lightcoral;
        margin-top: 30px;
      }

      span {
        line-height: 60px;
        display: none;
      }

      /* 当页面宽度是800px-1000px的时候，一行显示3个子元素 */
      @media screen and (min-width: 800px) and (max-width: 1000px) {
        .wrap {
          width: 800px;
        }
      }

      /* 当页面宽度是600px-800px的时候，一行显示2个子元素 */
      @media screen and (min-width: 600px) and (max-width: 800px) {
        .wrap {
          width: 600px;
        }
        .item {
          width: 280px;
        }
        ul {
          /* 隐藏元素,不可见 */
          display: none;
        }
        span {
          /* 显示元素 */
          display: block;
        }
      }

      /* 当页面宽度是小于600px的时候，认为就是手机端了，一行显示1个子元素  */
      @media screen and (max-width: 600px) {
        .wrap {
          width: 90%;
        }
        .item {
          width: 100%;
        }
        ul {
          /* 隐藏元素,不可见 */
          display: none;
        }
        span {
          /* 显示元素 */
          display: block;
        }
      }
    </style>
  </head>
  <body>
    <div class="header">
      <ul>
        <li>首页</li>
        <li>关于页</li>
        <li>详情页</li>
        <li>我的</li>
      </ul>

      <span>🏀</span>
    </div>
    <div class="wrap">
      <div class="item">1</div>
      <div class="item">2</div>
      <div class="item">3</div>
      <div class="item">4</div>
      <div class="item">5</div>
      <div class="item">6</div>
      <div class="item">7</div>
      <div class="item">8</div>
      <div class="item">9</div>
      <div class="item">10</div>
      <div class="item">11</div>
      <div class="item">12</div>
      <div class="item">13</div>
      <div class="item">14</div>
      <div class="item">15</div>
      <div class="item">16</div>
      <div class="item">17</div>
      <div class="item">18</div>
      <div class="item">19</div>
      <div class="item">20</div>
      <div class="item">21</div>
      <div class="item">22</div>
      <div class="item">23</div>
      <div class="item">24</div>
    </div>
  </body>
</html>
